package com.pro.system.Controller;

import com.pro.system.Repository.MovieRepository;
import com.pro.system.entity.Movie;
import com.pro.system.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping
public class maincontroller {

    @Autowired
    MovieRepository movieRepository;

    @GetMapping("admin")
    public String displayUserForm(){
        return "web/background/index";
    }

    @GetMapping
    public String displayFgForm(Model model){
        List<Movie> orderByHot = movieRepository.findOrderByHot(6);
        model.addAttribute("movie",orderByHot);
        return "web/foreground/index";
    }

    @GetMapping("index-after")
    public String displayAfterFgForm(Model model){
        List<Movie> orderByHot = movieRepository.findOrderByHot(6);
        model.addAttribute("movie",orderByHot);
        return "web/foreground/index-after";
    }

    @GetMapping("fgdetail")
    public String displaydetailFgForm(){
        return "web/foreground/fgdetail";
    }
}
